import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import tailwindcss from '@tailwindcss/vite'
import VueRouter from 'unplugin-vue-router/vite'

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [
		VueRouter({
      /* options */
    }),
		vue(),
		tailwindcss(),
	],
	resolve: {
		alias: {
			'@': fileURLToPath(new URL('./src', import.meta.url))
		}
	},
	server: {
		port: 5173, // 指定开发服务器端口
		open: true, // 启动后打开浏览器
		cors: true, // 允许跨域请求
		host: '0.0.0.0', // 允许外部访问 监听所有地址
	},
	css: {
		preprocessorOptions: {
			scss: {
				api: 'modern-compiler', // or "modern", "legacy"
				importers: [
					// ...
				],
			},
		},
	},
})